#!/bin/bash
# $Id$

tmpmnt="$(mktemp -d /tmp/tmp.XXXXXX)"

if [ -L /dev/cdrom ]; then
 	mount -o ro -t iso9660 /dev/cdrom $tmpmnt 2> /dev/null
 	if [ $? = 0 ]; then
 		echo /dev/cdrom > /var/tmp/cdrom_device
 		umount -f $tmpmnt 2>/dev/null
		exit 0
	fi
fi

for device in /dev/hd[a-z]; do
	mount -o ro -t iso9660 $device $tmpmnt 2> /dev/null
	if [ $? = 0 ]; then
  		[ ! -L /dev/cdrom ] && ln -s $device /dev/cdrom
  		echo $device > /var/tmp/cdrom_device
  		umount $tmpmnt 2>/dev/null
  		exit 0
 	else
  		umount -f $tmpmnt 2>/dev/null
  		continue
	fi
done

# vim: ts=2
# lookfor-cdrom.sh: end 
